<template>
  <el-form :inline="true" :model="p.filter" class="demo-form-inline" ref="ruleFormRef">
    <template v-for="(item, index) in p.columns" :key="index">
      <el-form-item :label="item.label" v-if="item.valueType">
        <template v-if="item.valueType === 'input'">
          <el-input v-model.trim="p.filter[item.prop]" :placeholder="`请输入${item.label}`" />
        </template>
        <template v-if="item.valueType === 'select'">
          <el-select clearable v-model="p.filter[item.prop]" :placeholder="`请选择${item.label}`">
            <el-option v-for="ite in item.options" :key="ite.value" :label="ite.label" :value="ite.value" />
          </el-select>
        </template>
        <template v-if="item.valueType === 'slot'">
          <slot :name="item.prop"></slot>
        </template>
      </el-form-item>
    </template>
    <slot name="filter"></slot>
    <el-form-item>
      <el-button icon="Refresh" @click="reset(p)">重置</el-button>
      <el-button icon="Search" type="primary" @click="onSubmit(p)">查询</el-button>
    </el-form-item>
  </el-form>
</template>

<script lang="ts" src="./search.ts" />